﻿@model Alma.Models.ProductListModel

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewContext.Controller.ViewBag.Breadcrumb.Enter("Catégories", "Index", "Categories");
   // ViewContext.Controller.ViewBag.Breadcrumb.Enter(@Model.Name_Cat, "Show", "Category", new { id = Model.ID_Cat });

    ViewContext.Controller.ViewBag.Breadcrumb.Enter(Model.Name_Cat, "Show", "Category", new { id = Model.ID_Cat });
    ViewContext.Controller.ViewBag.Breadcrumb.Enter(Model.Name);
    
}
@* @Html.ActionLink("Accueil", "Index", "Home") >> @Html.ActionLink(Model.Name_Cat, "Show", "Category", new { id = Model.ID_Cat }, null) >> @Html.ActionLink(Model.Name, "Show", "Section", new { id = Model.ID }, null)
*@
<div class="fullcol">
<h1>@Model.Name</h1>
@if (Model.Criterions.Count > 0)
{
    using (Html.BeginForm("Search", "Section", new { id = Model.ID }, FormMethod.Post, new { @class = "sectionSearch" }))
    {
    <ul>
    @foreach (var secCrit in Model.Criterions)
    {
        var critName = "Criterion_" + secCrit.ID_Criterion;
        <li><label for="@critName">@secCrit.Criterion.Name
        @switch (secCrit.Criterion.Method)
        {
            case 0:
                @:contient
                break;
            case 1:
                @:=
                break;
        }
        </label>@Html.TextBox(critName, "")</li>
    }
    </ul>
    @Html.Hidden("ID_Section", Model.ID);
    <button type="submit" name="Action" value="Search">Rechercher</button>
    }
}
<div class="boxes">
    @foreach (var product in Model.List)
    {
         <div>
         @{
        var prodUrl = Url.Action("Show", "Product", new { id = product.ID });
        }
        <img src="@Url.Content(product.ImgUrl)" alt="@product.ImgUrl" />
        <a href="@prodUrl"><h1>@product.Name</h1></a>
        <p>@product.Description
         <a href="@prodUrl">Consulter...</a></p>
        </div>
    }
    </div>
</div>